/*!
 * 自定义js 函数
 * version: ecp
 * build: Wed Dec 16 2018 16:56:18 GMT+0800 (中国标准时间)
 */

var getUrlParam = function(name) {var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);if (r != null) return unescape(r[2]); return null;}
var isDataNull = function(str) {if (str == null || str == "" || str == undefined || str == '[]') {return true;}return false;}
var checkCredNum = function(value){
	value = value.toUpperCase();
    var len, re;
    len = value.length;
    //身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X。
    //20位则为残疾证号
    if(len != 20){
	    if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(value))) {
	        return false;
	    }
    }
    
    //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
    //下面分别分析出生日期和校验位 
    if (len == 15) {
        re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
        var arrSplit = value.match(re);
        //检查生日日期是否正确 
        var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
        var bGoodDay;
        bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
        if (!bGoodDay) {
            return false;
        }else {
            //将15位身份证转成18位 
            //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var nTemp = 0, i;
            value = value.substr(0, 6) + '19' + value.substr(6, value.length - 6);
            for (i = 0; i < 17; i++) {
                nTemp += value.substr(i, 1) * arrInt[i];
            }
            value += arrCh[nTemp % 11];
            return true;
        }
        return false;
    }
    if (len == 18 || len == 20) {
        re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
        value = value.substring(0,18);
        var arrSplit = value.match(re);

        //检查生日日期是否正确 
        var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
        var bGoodDay;
        bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
        if (!bGoodDay) {
            return false;
        }else {
            //检验18位身份证的校验码是否正确。 
            //校验位按照ISO 7064:1983.MOD 11-2的规定生成，X可以认为是数字10。 
            var valnum;
            var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
            var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
            var nTemp = 0, i;
            for (i = 0; i < 17; i++) {
                nTemp += value.substr(i, 1) * arrInt[i];
            }
            valnum = arrCh[nTemp % 11];
            if (valnum != value.substr(17, 1)) {
                return false;
            }
            return true;
        }
        return false;
    }
}
var checkTelnum = function(value){
	var length = value.length; 
	  var mobile = /^((13[0-9])|(14[0-9])|(17[0-9])|(15[^4,\D])|(18[0-9])|(166)|(19[89]))\d{8}$/;
	 // var fixPhone = /^([0-9]{3,4}-)?[0-9]{7,8}$/;
	  //return this.optional(element) || mobile.test(value) || fixPhone.test(value);
	  return mobile.test(value);
}
function openCompanyInfo(){
	window.location.href = "../../cltweb/page/companyPage.html";
}
function openPersonInfo(){
	window.location.href = "../../cltweb/page/personPage.html";
}
function checkNewsMore(){
	window.location.href="../../cltweb/page/newsPage.html";
}
function openProducgtInfo(){
	window.location.href="../../cltweb/page/productPage.html";
}
function openInvestInfo(){
	window.location.href="../../cltweb/page/investPage.html";
}
function openSignUPInfo(){
	window.location.href="../../cltweb/page/signUpInfoPage.html";
}
function openIndex(){
	window.location.href="../../cltweb/page/index.html";
}
function openRecruitInfo(){
	window.location.href="../../cltweb/page/recruitPage.html";
}
function openVideoInfo(){
	window.location.href="../../cltweb/page/videoPage.html";
}
var menuHtml = '<div class="navbar"><div class="container"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"><i class="fw-icon-th-list"></i></button></div><div class="menu_stl">'+
'<ul class=""><li><a href="../../index.html">首页</a></li><li><a href="###">企业信息</a>'+
'<ul><li><a href="companyPage.html" class="tran300">企业简介</a></li><li><a href="personPage.html" class="tran300">董事长介绍</a></li></ul></li>'+
'<li><a href="###">新闻资讯</a>'+
'<ul><li><a href="newsPage.html" class="tran300">新闻资讯</a></li></ul></li>'+
'<li><a href="#">产品介绍</a>'+
'<ul><li><a href="productPage.html" class="tran300">产品介绍</a></li></ul></li><li>'+
'<a href="#">招商加盟</a>'+
'<ul><li><a href="investPage.html" class="tran300">特色项目</a></li></ul></li>'+
	  /*'<li><a href="videoPage.html" >视频音频</a></li>'+
*/	  '<li><a href="###">我要报名</a>'+
	  '<ul><li><a href="signUpInfoPage.html" class="tran300">我要报名</a></li></ul></li>'+
	  '<li><a href="recruitPage.html">招聘英才</a></li></ul></div></div></div>';

$(function(){
	$("#menuId").html(menuHtml);
	$("#foodId").html(footPage);
	$(".logOut").on('click',function(){
		window.location.href="../../logout";
	});
})

var footPage = 
'<div class="copy-rights"><div class="container">'+
'<div class="row"><div class="col-md-6">'+
'<div class="foodStl"><span>公司地址：河南省郑州市玉凤路南浦国际16层1601室</span><span>联系电话：18339241313</span></div><div class="foodStl"><span>版权所有：郑州禅疗堂公司</span><span>豫ICP备18035209号</span></div>'+
'</div></div></div>';